Simplify set_px_info hypercall 32-on-64 compatibility shim.
authorKeir Fraser <keir.fraser@citrix.com>
Wed, 22 Oct 2008 10:53:51 +0000 (11:53 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Wed, 22 Oct 2008 10:53:51 +0000 (11:53 +0100)
Mark processor_px as 'checking' and translate handle to simplify
actual code doing in the translation.
(According to Jan Beulich's suggestion)

Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
xen/arch/x86/x86_64/cpufreq.c
xen/include/xlat.lst

index 1931eecfafefabc1f383e67c5c60108b8b58f6b6..d005dfdc6d2e18e2c78a5515e696cf8f37894411 100644 (file)
@@ -56,34 +56,13 @@ compat_set_px_pminfo(uint32_t cpu, struct compat_processor_performance *perf)
        return -EFAULT;
 
 #define XLAT_processor_performance_HNDL_states(_d_, _s_) do { \
-    xen_processor_px_t *xen_states = NULL; \
-\
-    if ( likely((_s_)->state_count > 0) ) \
-    { \
-        XEN_GUEST_HANDLE(compat_processor_px_t) states; \
-        compat_processor_px_t state; \
-        int i; \
-\
-        xen_states = xlat_malloc_array(xlat_page_current, \
-                               xen_processor_px_t, (_s_)->state_count); \
-        if ( unlikely(xen_states == NULL) ) \
-            return -EFAULT; \
-\
-        if ( unlikely(!compat_handle_okay((_s_)->states, \
-                                (_s_)->state_count)) ) \
-            return -EFAULT; \
-        guest_from_compat_handle(states, (_s_)->states); \
-\
-        for ( i = 0; i < _s_->state_count; i++ ) \
-        { \
-           if ( unlikely(copy_from_guest_offset(&state, states, i, 1)) ) \
-               return -EFAULT; \
-           XLAT_processor_px(&xen_states[i], &state); \
-        } \
-    } \
-\
-    set_xen_guest_handle((_d_)->states, xen_states); \
+    XEN_GUEST_HANDLE(compat_processor_px_t) states; \
+    if ( unlikely(!compat_handle_okay((_s_)->states, (_s_)->state_count)) ) \
+        return -EFAULT; \
+    guest_from_compat_handle(states, (_s_)->states); \
+    (_d_)->states = guest_handle_cast(states, xen_processor_px_t); \
 } while (0)
+
     XLAT_processor_performance(xen_perf, perf);
 #undef XLAT_processor_performance_HNDL_states
 
index c38dd39a9f7047464ec9de225cafecc9bf1c6b92..b10d215254b33c8196abd860ddde884bd163834d 100644 (file)
@@ -56,6 +56,6 @@
 !      processor_flags                 platform.h
 !      processor_power                 platform.h
 !      pct_register                    platform.h
-!      processor_px                    platform.h
+?      processor_px                    platform.h
 !      psd_package                     platform.h
 !      processor_performance           platform.h